<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta charset="<?php echo $_REQUEST['charset']?>">
<title>
            本地淘，购物分类，
    <?php
    	for ($i=count($_REQUEST['productTypeList']);$i-1>=0;$i--) {
            echo $_REQUEST['productTypeList'][$i-1]['prodTypeName'];
        	if($i-1!=0)echo '-';
    	}
    ?>
</title>
<?php
echo getCommon ();
echo getPlug ( array (
		"belatedPNG" ,
        "lazyload"
) );
echo getPageCss ( "product/css/listproduct.css" );
?>
</head>
<script type="text/javascript">
	jQuery(document).ready(function($){
		$("img.lazy").lazyload({
			placeholder : "<?php echo getCommonImgUrl()?>/grey.gif", //加载图片前的占位图片 
			effect : "fadeIn" //加载图片使用的效果(淡入)
		});
	});
</script>
<body>
	<?php tsInclude('/webyufeiModule/common/head/head?prodTypeId='.$_REQUEST['prodTypeId'].'&keyword='.$_REQUEST['keyword']);?>
	<?php tsInclude('/webyufeiModule/common/nav/nav?navTypeId='.$_REQUEST['navTypeId']);?>
	<?php 
	   //整理商品图片
	   function sortProductImgUrl($imgUrl){
            $imgUrlArray = explode('.', $imgUrl);
            return $imgUrlArray[0].'_218x218.'.$imgUrlArray[1];
       }
       
       //整理关键词高亮显示
       function highlightKeyword($goodsName){
            $keywordArray = explode('%', $_REQUEST['keyword']);
            for($i=0;$i<count($keywordArray);$i++){
                $goodsName = str_replace($keywordArray[$i], '<font>'.$keywordArray[$i].'</font>', $goodsName);
            }
            
            return $goodsName;
       }
	?>
	<input type="hidden" name="prodTypeId" value="<?php echo $_REQUEST['prodTypeId']?>"/>
	<input type="hidden" name="type" value="<?php echo $_REQUEST['type']?>"/>
	<input type="hidden" name="navTypeId" value="<?php echo $_REQUEST['navTypeId']?>"/>
	<input type="hidden" name="listproductsUrl" value="<?php echo $_REQUEST['listproductsUrl']?>"/>
	<input type="hidden" name="listproductsSingleUrl" value="<?php echo $_REQUEST['listproductsSingleUrl']?>"/>
    <div id="cate-nav">
    	<div class="cate">
        	<a href="/">首页</a>&nbsp;>&nbsp;
        </div>
        <?php
    		for ($i=count($_REQUEST['productTypeList']);$i-1>=0;$i--) {
        ?>
            <div class="cate">
            	<a href="<?php echo $_REQUEST['listproductsSingleUrl']?>?prodTypeId=<?php echo $_REQUEST['productTypeList'][$i-1]['prodTypeId']?>"><?php echo $_REQUEST['productTypeList'][$i-1]['prodTypeName']?></a>
            	<?php if($i-1!=0)echo '&nbsp;>&nbsp;'?>
            </div>
    	<?php 
    		}
		?>
        <div class="search">
        	<div class="container">
            	<input type="text" name="keyword" value="<?php if(isset($_REQUEST['keyword']) and $_REQUEST['keyword']!='' and isset($_REQUEST['prodTypeId']) and $_REQUEST['prodTypeId']!=0) echo str_replace("%"," ",$_REQUEST['keyword']);?>"/>
            </div>
            <div class="btn" id="go-cate-search"></div>
        </div>
    </div>
    <div id="condition">
    	<div class="item <?php if($_REQUEST['sortName']=='prodRecomLevel' and $_REQUEST['sortType']=='asc') echo 'current';?>" id="recommend-order">
        	推荐<div class="icon down-icon <?php if($_REQUEST['sortName']=='prodRecomLevel' and $_REQUEST['sortType']=='asc') echo 'down-mouseover-icon';?>"></div>
        </div>
        <div class="item <?php if($_REQUEST['sortName']=='prodNowPrice') echo 'current';?>" id="price-order">
        	价格<div class="icon twoway-icon <?php if($_REQUEST['sortName']=='prodNowPrice' and $_REQUEST['sortType']=='asc') echo 'twoway-up-icon';?><?php if($_REQUEST['sortName']=='prodNowPrice' and $_REQUEST['sortType']=='desc') echo 'twoway-down-icon';?>"></div>
        </div>
        <div class="item <?php if($_REQUEST['sortName']=='prodCreateTime' and $_REQUEST['sortType']=='desc') echo 'current';?>" id="newgoods-order">
        	新品<div class="icon down-icon <?php if($_REQUEST['sortName']=='prodCreateTime' and $_REQUEST['sortType']=='desc') echo 'down-mouseover-icon';?>"></div>
        </div>
        <div class="item <?php if($_REQUEST['sortName']=='prodAppraise' and $_REQUEST['sortType']=='desc') echo 'current';?>" id="evaluate-order">
        	评价<div class="icon down-icon <?php if($_REQUEST['sortName']=='prodAppraise' and $_REQUEST['sortType']=='desc') echo 'down-mouseover-icon';?>"></div>
        </div>
        <div class="price" id="priceFrame">
            <input type="text" name="lowPrice" class="low-price png_bg" title="按价格区间筛选 最低价" value="<?php if($_REQUEST['lowPrice']>0) echo $_REQUEST['lowPrice'];?>"/>
            <div class="line">-</div>
            <input type="text" name="highPrice" class="high-price png_bg" title="按价格区间筛选 最高价" value="<?php if($_REQUEST['highPrice']>0) echo $_REQUEST['highPrice'];?>"/> 
            <span class="btn"><button type="button" class="i" id="go-price">确定</button></span>
        </div>
        <div class="pageinfo">
        	<div class="info"><?php echo $_REQUEST['pageInfo']['currentPage']?>/<?php echo $_REQUEST['pageInfo']['countPage']?></div>
        	<?php if($_REQUEST['pageInfo']['currentPage']>1){?>
                <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']-1?>" class="pageicon">&lt;</a>
            <?php }else{?>
                <div class="pageicon disable">&lt;</div>
            <?php }?>
            <?php if($_REQUEST['pageInfo']['currentPage']<$_REQUEST['pageInfo']['countPage']){?>
                <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']+1?>" class="pageicon">&gt;</a>
            <?php }else{?>
                <div class="pageicon disable">&gt;</div>
            <?php }?>
        </div>
    </div>
    <div id="goods-grid">
        <?php
            if(count($_REQUEST['productsData'])>0){
    		foreach ($_REQUEST['productsData'] as $i => $product) {
        ?>
            <div class="goods">
            	<div class="img">
                	<a target="_blank" href="<?php echo $product['prodUrl']?>" productId="<?php echo $product['prodId']?>">
                	   <img src="<?php echo sortProductImgUrl($product['photoUrl'])?>" class="lazy"/>
                	</a>
                </div>
                <div class="price"><font>¥</font><b title="现价"><?php echo $product['prodNowPrice']?></b>&nbsp;<s title="原价"><?php if($product['prodPrice']) echo $product['prodPrice']?></s></div>
                <div class="title">
                    <a target="_blank" href="<?php echo $product['prodUrl']?>" productId="<?php echo $product['prodId']?>">
                        <?php 
                            if(isset($_REQUEST['keyword']) and $_REQUEST['keyword']!='') echo highlightKeyword($product['prodName']);
                            else echo $product['prodName'];
                        ?>
                    </a>
                </div>
                <div class="appraise"><a>已有<?php echo floor($product['prodAppraise'])?>人评价</a></div>
                <div class="shadow-t"></div>
                <div class="shadow-tborder"></div>
                <div class="shadow-l"></div>
                <div class="shadow-r"></div>
                <div class="shadow-b"></div>
                <div class="shopname">
                	<a target="_blank" href="<?php echo $product['shopUrl']?>"><?php echo $product['shopName']?></a>
                </div>
            </div>
    	<?php
    		}
            }else{ 
                if(isset($_REQUEST['keyword']) and $_REQUEST['keyword']!=''){
		?>
    	    <div class="no-goods">
            	<img src="<?php echo getCommonImgUrl();?>/no_goods.png" align="absmiddle"/>
                sorry!没有找到与"<font><?php echo str_replace("%"," ",$_REQUEST['keyword']);?></font>"相关的宝贝
            </div>
		<?php 
		        }else{
        ?>
            <div class="no-goods">
            	<img src="<?php echo getCommonImgUrl();?>/no_goods.png" align="absmiddle"/>
                sorry!该分类下还没有相关产品
            </div>
        <?php
                }
		  }
		?>
    	
        <!-- <div class="goods">
        	<div class="img">
            	<img src="<?php echo getCommonImgUrl()?>/goods1_r1_c8_s1.png" class="lazy"/>
            </div>
            <div class="price">￥1499.00</div>
            <div class="title"><a href="#">玛仕蒂夫 软床 皮艺床 小户型 U202 图片标准色 1800*2000mm百</a></div>
            <div class="appraise"><a href="#">已有1404人评价</a></div>
            <div class="shadow-t"></div>
            <div class="shadow-tborder"></div>
            <div class="shadow-l"></div>
            <div class="shadow-r"></div>
            <div class="shadow-b"></div>
            <div class="shopname">
            	<a href="#">艺品天辰旗舰店</a>
            </div>
        </div>
         -->
        <div class="auto-height"></div>
    </div>
    <div id="pageinfo">
        <?php if($_REQUEST['pageInfo']['currentPage']>1){?>
            <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']-1?>" class="icon">&lt;上一页</a>
        <?php }?>
        <?php if($_REQUEST['pageInfo']['currentPage']-2>=1){?>
            <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']-2?>" class="icon"><?php echo $_REQUEST['pageInfo']['currentPage']-2?></a>
        <?php }?>
        <?php if($_REQUEST['pageInfo']['currentPage']-1>=1){?>
            <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']-1?>" class="icon"><?php echo $_REQUEST['pageInfo']['currentPage']-1?></a>
        <?php }?>
    	<a class="icon" href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']?>"><?php echo $_REQUEST['pageInfo']['currentPage']?></a>
        <?php if($_REQUEST['pageInfo']['currentPage']+1<=$_REQUEST['pageInfo']['countPage']){?>
            <a class="icon" href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']+1?>"><?php echo $_REQUEST['pageInfo']['currentPage']+1?></a>
        <?php }?>
        <?php if($_REQUEST['pageInfo']['currentPage']+2<=$_REQUEST['pageInfo']['countPage']){?>
            <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']+2?>" class="icon"><?php echo $_REQUEST['pageInfo']['currentPage']+2?></a>
        <?php }?>
        <?php if($_REQUEST['pageInfo']['currentPage']<$_REQUEST['pageInfo']['countPage']){?>
            <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['currentPage']+1?>" class="icon">下一页&gt;</a>
        <?php }?>
        <a href="<?php echo $_REQUEST['listproductsUrl']?>&currentPage=<?php echo $_REQUEST['pageInfo']['countPage']?>" class="icon">末页&gt;</a>
    </div>
    <?php tsInclude('/webyufeiModule/common/footer/footer');?>
	<?php getPageJs("product/listproduct.js")?>
</body>
</html>
